package client;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

/**
 * @file Client.java
 * @version 0.2
 * @author James Dibble 10009689
 * 
 * Latest Source:
 * http://code.google.com/p/csp-server/source/browse/
 *                                           trunk/Server/src/client/Client.java
 */
public class Client{
    // <editor-fold defaultstate="collapsed" desc="Attributes">
    private static Socket sSocket;
    private PrintWriter pwServerOutput;
    private Scanner scnrInput = new Scanner(System.in);
    private Client_Type type;
    private Server_Response serverResponse;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructors">
    /**
     * Create an object that listens on a socket and sends messages on this
     * socket.
     * 
     * @param strServerIP
     * @param intPort
     * @param type
     * @throws UnknownHostException
     * @throws IOException 
     */
    public Client(String strServerIP, int intPort, Client.Client_Type type) throws UnknownHostException, IOException {
        sSocket = new Socket(strServerIP, intPort);
        this.type = type;
        serverResponse = new Server_Response(sSocket);
        new Thread(serverResponse).start();
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    // </editor-fold>
    
    /**
     * What type of client has been/is to be created?
     */
    public enum Client_Type{
        /**
         * The client will request a description.
         */
        DESCRIPTION_CLIENT,
        /**
         *  The client will request a file.
         */
        FILE_CLIENT
    }
}
